cmake_minimum_required(VERSION 2.8)
project(Packetcapture)

set(CMAKE_CXX_STANDARD 11)

#公共路径
set(COMMON_LIB_PATH /opt/cdk)
#poco文件路径
set(POCO_LIB_PATH ${COMMON_LIB_PATH}/poco/v1.6.0)
#gtest路径
set(GTEST_LIB_PATH ${COMMON_LIB_PATH}/gtest/v1.8.0)
#pcap路径
set(PCAP_LIB_PATH ${COMMON_LIB_PATH}/pcap/v1.8.1)
#taiji路径
set(TAIJI_LIB_PATH ${COMMON_LIB_PATH}/taiji/v1.0)
#rabbitmq路径
set(RABBITMQ_LIB_PATH ${COMMON_LIB_PATH}/rabbitmq-c/v0.8.1)



include_directories(
        ${POCO_LIB_PATH}/include
        ${GTEST_LIB_PATH}/include
        ${PCAP_LIB_PATH}/include
        ${TAIJI_LIB_PATH}/include
        ${RABBITMQ_LIB_PATH}/include
)
link_directories(
        ${POCO_LIB_PATH}/lib
        ${GTEST_LIB_PATH}/lib
        ${PCAP_LIB_PATH}/lib
        ${RABBITMQ_LIB_PATH}/lib)
include_directories(
        Common
        .
)


set(SOURCE_FILES
        AppLication/CustomServerApplication.cpp
        AppLication/CustomServerApplication.h
        Pacap/PackType.cpp
        Pacap/PackType.h
        Pacap/gtest/CaputerCapDataTest.cpp
        Pacap/gtest/CaputerCapDataTest.h
        Pacap/gtest/InetIpv4Test.cpp
        Pacap/gtest/InetIpv4Test.h
        Pacap/gtest/InetTcpTest.cpp
        Pacap/gtest/InetTcpTest.h
        Pacap/gtest/PcapMsgTest.cpp
        Pacap/gtest/PcapMsgTest.h
        Pacap/CaputerCapData.cpp
        Pacap/CaputerCapData.h
        Pacap/InetIpv4.cpp
        Pacap/InetIpv4.h
        Pacap/InetTcp.cpp
        Pacap/InetTcp.h
        Pacap/InterfacePackOperation.h
        Pacap/PcapExceptions.h
        Pacap/PcapMsg.cpp
        Pacap/PcapMsg.h
        SendMq/Exception.cpp
        SendMq/Exception.h
        SendMq/SendMq.cpp
        SendMq/SendMq.h

        Service/CapPackService.cpp
        Service/CapPackService.h
        common_cap.h
        main.cpp HttpRequestParse/HttpRequest.cpp HttpRequestParse/HttpRequest.h)

add_executable(Packetcapture ${SOURCE_FILES})

add_custom_command(TARGET Packetcapture
        POST_BUILD
        COMMENT "添加抓包权限,如果启动不了请使用 root 启动"
        COMMAND sudo setcap cap_net_raw,cap_net_admin=eip ./Packetcapture
        )

target_link_libraries(Packetcapture
        PocoFoundation
        PocoUtil
        PocoNet
        PocoJSON
        pcap
        rabbitmq
        gtest
        gtest_main
        pthread)
